package com.haixiaoke.saas.repository.service.impl;

import com.haixiaoke.saas.repository.mapper.ElectronicSigningContractMapper;
import com.haixiaoke.saas.repository.pojo.ElectronicSigningContract;
import com.haixiaoke.saas.repository.service.IElectronicSigningContractService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;


/**
 * 电子签合同信息Service业务层处理
 *
 * @author qixi
 * @date 2023-12-26
 */
@Service
public class ElectronicSigningContractServiceImpl implements IElectronicSigningContractService {
    @Autowired
    private ElectronicSigningContractMapper electronicSigningContractMapper;

    /**
     * 查询电子签合同信息
     *
     * @param contractId 电子签合同信息主键
     * @return 电子签合同信息
     */
    @Override
    public ElectronicSigningContract selectElectronicSigningContractByContractId(Long contractId) {
        return electronicSigningContractMapper.selectElectronicSigningContractByContractId(contractId);
    }

    /**
     * 查询电子签合同信息列表
     *
     * @param electronicSigningContract 电子签合同信息
     * @return 电子签合同信息
     */
    @Override
    public List<ElectronicSigningContract> selectElectronicSigningContractList(ElectronicSigningContract electronicSigningContract) {
        return electronicSigningContractMapper.selectElectronicSigningContractList(electronicSigningContract);
    }

    @Override
    public List<ElectronicSigningContract> selectElectronicSigningContractOrHouseInfoList(ElectronicSigningContract electronicSigningContract) {
        return electronicSigningContractMapper.selectElectronicSigningContractOrHouseInfoList(electronicSigningContract);
    }

    /**
     * 新增电子签合同信息
     *
     * @param electronicSigningContract 电子签合同信息
     * @return 结果
     */
    @Override
    public int insertElectronicSigningContract(ElectronicSigningContract electronicSigningContract) {
        electronicSigningContract.setCreateTime(new Date());
        return electronicSigningContractMapper.insertElectronicSigningContract(electronicSigningContract);
    }

    /**
     * 修改电子签合同信息
     *
     * @param electronicSigningContract 电子签合同信息
     * @return 结果
     */
    @Override
    public int updateElectronicSigningContract(ElectronicSigningContract electronicSigningContract) {
        electronicSigningContract.setUpdateTime(new Date());
        return electronicSigningContractMapper.updateElectronicSigningContract(electronicSigningContract);
    }

    /**
     * 批量删除电子签合同信息
     *
     * @param contractIds 需要删除的电子签合同信息主键
     * @return 结果
     */
    @Override
    public int deleteElectronicSigningContractByContractIds(Long[] contractIds) {
        return electronicSigningContractMapper.deleteElectronicSigningContractByContractIds(contractIds);
    }

    /**
     * 删除电子签合同信息信息
     *
     * @param contractId 电子签合同信息主键
     * @return 结果
     */
    @Override
    public int deleteElectronicSigningContractByContractId(Long contractId) {
        return electronicSigningContractMapper.deleteElectronicSigningContractByContractId(contractId);
    }

    @Override
    public ElectronicSigningContract selectElectronicSigningContractByFlowId(String flowId) {
        return electronicSigningContractMapper.selectElectronicSigningContractByFlowId(flowId);
    }

    @Override
    public List<ElectronicSigningContract> selectElectronicSigningContractOrHouseInfoContractList(ElectronicSigningContract electronicSigningContract) {
        return electronicSigningContractMapper.selectElectronicSigningContractOrHouseInfoContractList(electronicSigningContract);
    }

    @Override
    public List<ElectronicSigningContract> selectElectronicSigningContractOrHouseInfoListByUser(ElectronicSigningContract electronicSigningContract) {
        return electronicSigningContractMapper.selectElectronicSigningContractOrHouseInfoListByUser(electronicSigningContract);

    }

    @Override
    public boolean checkContractExist(ElectronicSigningContract electronicSigningContract) {
        return electronicSigningContractMapper.checkContractExist(electronicSigningContract) > 0;
    }

    @Override
    public List<ElectronicSigningContract> selectElectronicSigningContractByContractIds(List<Long> contractIds) {
        return electronicSigningContractMapper.selectElectronicSigningContractByContractIds(contractIds);
    }

}
